package com.javaWork.service.impl;

import com.javaWork.entity.PetsOfUser;
import com.javaWork.mapper.PetsOfUserMapper;
import com.javaWork.service.PetsOfUserService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author CheHan
 * @date 2022/4/9 0:23
 */
@Service
public class PetsOfUserServiceImpl implements PetsOfUserService {

    private final PetsOfUserMapper petsOfUserMapper;

    public PetsOfUserServiceImpl(PetsOfUserMapper petsOfUserMapper) {
        this.petsOfUserMapper = petsOfUserMapper;
    }

    @Override
    public List<PetsOfUser> queryAllPetsOfUser(String userName) {
        return petsOfUserMapper.queryAllPetsOfUser(userName);
    }

    @Override
    public int addPetsForUser(String userName, PetsOfUser petsOfUser) {
        return petsOfUserMapper.addPetsForUser(userName, petsOfUser);
    }

    @Override
    public void deleteAllPetsOfUser(String userName) {
        petsOfUserMapper.deleteAllPetsOfUser(userName);
    }

    @Override
    public PetsOfUser queryLastPet(String userName) {
        return petsOfUserMapper.queryLastPet(userName);
    }
}
